package com.robam.cloud.common.bean.authcenter.entity.wechat.message.model;

import com.robam.cloud.common.bean.authcenter.entity.wechat.message.MsgType;
import com.robam.cloud.common.bean.authcenter.entity.wechat.message.shared.Article;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.util.Arrays;
import java.util.List;

/**
 * 回复图文消息
 */
@XStreamAlias("xml")
public class RespMsgNews extends RespMsg {
    @XStreamAlias("Articles")
    private List<Article> articles;
    @XStreamAlias("ArticleCount")
    private int articleCount;

    public RespMsgNews(BaseMsg req, List<Article> articles) {
        super(req, MsgType.RespType.news.name());
        setArticles(articles);
        this.articleCount = articles.size();
    }

    public RespMsgNews(BaseMsg req, Article... articles) {
        this(req, Arrays.asList(articles));
    }

    public List<Article> getArticles() {
        return articles;
    }

    public void setArticles(List<Article> articles) {
        this.articles = articles;
        this.articleCount = articles.size();
    }

    public int getArticleCount() {
        return articleCount;
    }
}
